package com.lxl.mapper;

import com.github.pagehelper.Page;
import com.lxl.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {

    @Select("select * from student")
    @Results(id = "studentMap",value = {
            @Result(id=true,column = "stu_id",property = "stu_id"),
            @Result(column = "stu_name",property = "stu_name"),
            @Result(column = "stu_sex",property = "stu_sex"),
            @Result(column = "chinese",property = "chinese"),
            @Result(column = "math",property = "math"),
            @Result(column = "english",property = "english"),
            @Result(column = "sci_total",property = "sci_total"),
            @Result(column = "total",property = "total")
    })
    Page<Student> allStudents();

    Integer addStudent(Student student);

    @Delete("delete from student where stu_id =#{stu_id}")
    Integer delStudent(String stu_id);


    @Update("update student set stu_name=#{stu_name},stu_sex=#{stu_sex},chinese=#{chinese},math=#{math},english=#{english},sci_total=#{sci_total},total=#{total} where stu_id=#{stu_id}")
    Integer editStudent(Student student);

}
